
#pragma once
#include "Renderer/VertexArray.h"
#include "glad/glad.h"
namespace Orange
{
    class OpenGLVertexArray : public VertexArray
    {
    public:
        OpenGLVertexArray();
        ~OpenGLVertexArray();

        static GLenum ShaderTypeToGLenum(ShaderDataType type)
        {
            switch (type)
            {
            case ShaderDataType::FLoat1:
            case ShaderDataType::FLoat2:
            case ShaderDataType::FLoat3:
            case ShaderDataType::FLoat4:
            case ShaderDataType::Mat3:
            case ShaderDataType::Mat4:
                return GL_FLOAT;
            case ShaderDataType::Int1:
            case ShaderDataType::Int2:
            case ShaderDataType::Int3:
            case ShaderDataType::Int4:
                return GL_INT;
            case ShaderDataType::BOOL:
                return GL_BOOL;
            }

            ORANGE_CORE_ASSERT(false, " unknown shader type ")
            return 0;
        }
        virtual void Bind() override;
        virtual void UnBind() override;

        virtual void AddVertexBuffer(const Ref<VertexBuffer> &vertexBuffer) override;
        virtual void SetIndexBuffer(const Ref<IndexBuffer> &indexBuffer) override;
        virtual std::vector<Ref<VertexBuffer>> &GetVertexBuffer() override;
        virtual Ref<IndexBuffer> &GetIndexBuffer() override;

    private:
        std::vector<Ref<VertexBuffer>> m_VertexBuffer;
        Ref<IndexBuffer> m_indexBuffer;
        uint32_t m_RendererId;
    };
}